<template>
    <input type="text" name="nuame" id="uname" v-model="uname">
    <input type="password" name="upwd" id="upwd" v-model="upwd">
    <button @click="send">点击发送axios请求</button>
</template>

<script>
import querystring from "querystring"
export default {
    name: "request",
    data() {
        return {
            uname: "",
            upwd: ""
        }
    },
    methods: {
        send() {
            console.log(this.uname, this.upwd);
            this.$axios.post("vuetest/", querystring.stringify({
                uname: this.uname,
                upwd: this.upwd
            })).then(res => {
                console.log(res.data);
            })
            // axios({
            //     method: "post",
            //     url: "http://localhost:8888/vuetest/",
            //     data: querystring.stringify({
            //         uname: this.uname,
            //         upwd: this.upwd
            //     }),
            //     withCredentials: false
            // }).then(res => {
            //     console.log("请求成功了");
            // })
        }
    }
}
</script>